<?PHP

$subcategories=$categories;

?>

	<ul>
		
		<?PHP
			foreach($categories as $x)
			{
				
				
				if($x['parent']==0)
				{
						?>

						<li class='headlink'>
							<a href="sc/<?PHP echo $x['id'];?>/category/<?PHP echo convert_string_to_query($x['name']);?>">
							<?PHP echo $x['name'];?>
							</a>
							
							<ul>
							<?PHP
								
								foreach($subcategories as $y)
								{


									if($y['parent']==$x['id'])
									{
								
										?>
							
							
							
										<li>
											<a href="sc/<?PHP echo $y['id'];?>/category/<?PHP echo convert_string_to_query($y['name']);?>">										<?PHP echo $y['name'];?>
											</a>
										</li>
										<?PHP
								
								
								
								
									}
								}
								?>
								
								
								
								
							</ul>
						</li>
						<?PHP
				}
				
				
				
				
			
			}
		
		?>
	</ul>
	
	<script type="text/javascript" charset="utf-8">
		$(document).ready(function(){
				$('li.headlink').hover(
					function() { $('ul', this).css('display', 'block'); },
					function() { $('ul', this).css('display', 'none'); });
			});
		
	</script>